//package com.luanye.enjoy.flowable.task;
//
//import com.alibaba.fastjson.JSON;
//import com.luanye.enjoy.config.SpringUtilConfig;
//import com.luanye.enjoy.dto.SmsDTO;
//import com.luanye.enjoy.utils.SensitiveFilter;
//import org.flowable.engine.delegate.DelegateExecution;
//import org.flowable.engine.delegate.JavaDelegate;
//import org.springframework.amqp.core.Message;
//import org.springframework.amqp.core.MessageProperties;
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
//import java.util.Map;
//import static com.luanye.enjoy.constants.MQConst.SMS_EXCHANGE;
//import static com.luanye.enjoy.constants.SmsConst.TEMPLATE_VILLAGE;
//
//public class CheckInfoDelegate implements JavaDelegate {
//
//
//    @Override
//    public void execute(DelegateExecution delegateExecution) {
//
//
//        Map<String, Object> variables = delegateExecution.getVariables();
//        this.sendStartSms(delegateExecution);
//
//        for (Map.Entry<String, Object> entry : variables.entrySet()) {
//            String digit = null;
//            try {
//                digit = (String) entry.getValue();
//            }catch (ClassCastException e){
//                continue;
//            }
//            if (digit == null || digit == "") continue;
//            boolean isSensitive = SensitiveFilter.DEFAULT.filter(digit, '*');
//            if (isSensitive){
//                delegateExecution.setVariable("outcome",0);
//                return;
//            }
//
//        }
//        delegateExecution.setVariable("outcome",1);
//    }
//
//    public void sendStartSms(DelegateExecution execution){
//        RabbitTemplate rabbitTemplate = SpringUtilConfig.getBean(RabbitTemplate.class);
//
//        String villageName = execution.getVariable("villageName", String.class);
//        String phone = execution.getVariable("phone", String.class);
//
//        SmsDTO dto = new SmsDTO(
//                phone,
//                new String[]{villageName, "系统信息鉴定"},
//                TEMPLATE_VILLAGE
//        );
//
//        rabbitTemplate.convertAndSend(SMS_EXCHANGE, "*", new Message(JSON.toJSONBytes(dto), new MessageProperties()));
//
//    }
//
//}
